const sequelize = require('../config/connect.js')//引入数据库连接文件
const config = require('../config/config.js')//引入数据库配置文件
const myorder = require('./myorder.js')//引入订单信息表
const { Op, Model, DataTypes } = require('sequelize')//引入nodejs的orm模型文件

class orderTracking extends Model{}  //订单跟踪信息表

orderTracking.init({
    orderNumber:{
        type:DataTypes.STRING(32),
        primaryKey:true,
        references:{
            model:myorder,
            key:'orderNumber'
        },
        comment:'订单号'
    },
    orderTime:{
        type:DataTypes.DATE,
        allowNull:true,
        comment:'预定时间'
    },
    checkInTime:{
        type:DataTypes.DATE,
        allowNull:true,
        comment:'实际入住时间'
    },
    checkOutTime:{
        type:DataTypes.DATE,
        allowNull:true,
        comment:'实际退房时间'
    },
    remarks:{
        type:DataTypes.STRING(32),
        allowNull:true,
        comment:'备注'
    }
},{
    sequelize,
    charset:config.charset,
    timestamps:false,
    freezeTableName:true,
    modelName:'orderTracking'
})

module.exports = orderTracking;
